Skip to content

Conversation

@bbugdigger
Copy link

YouTrack link: https://youtrack.jetbrains.com/issue/KT-53034/Native-call-System.gc-before-running-clang-and-other-memory-consuming-processes-from-the-compiler

Call System.gc() before invoking clang++ and linker to release unused JVM heap memory, reducing memory pressure for these external tools.

The Kotlin/Native compiler calls external tools (clang++, ld) with large inputs. These tools require significant memory. By triggering garbage collection before spawning them, we free up system memory that would otherwise be held by unused JVM objects.

@bbugdigger bbugdigger requested a review from a team as a code owner February 1, 2026 09:41
@bbugdigger bbugdigger requested a review from glukianets February 1, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant